<html>

<head>
<title>Swing JFrame Wizard</title>
<link href="../../../book.css" rel="stylesheet" type="text/css" />
</head>

<body>

<h1>Swing JFrame Wizard</h1>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td>
        <img src="images/wizard_swing_jframe0.gif" align="left" hspace="10">Subclasses of the Swing <b>JFrame</b> class can be
              created using the <b>Swing JFrame</b>&nbsp; wizard. The wizard can be
              selected from the drop down wizard menu or from the
              Eclipse <b>New</b> wizard.
              <p>To use the wizard, select the project source folder and package
              to contain the class. Then enter the class name and hit the <b>Finish</b>
              button.<p>The <b>javax.swing.JFrame</b> class is the default
              superclass. You can select an alternative superclass by entering
              its name into the <b>Superclass</b> field or by choosing it via
              the bottom <b>Browse</b> button.</td>
  </tr>
  <tr>
    <td>
      <br>
		<img src="images/wizard_swing_jframe1.gif">&nbsp; 
		<img src="images/wizard_swing_jframe2.gif"></td>
  </tr>
  <tr>
    <td>
      <p><br>
		The wizard generates the following code including a <b>main()</b> method.</p>
      <font SIZE="2" COLOR="#7f0055"><b>
		<blockquote>
			<p><font face="Courier">import</font></b></font><font SIZE="2"><font face="Courier"> 
		javax.swing.JFrame;</font></dd><br>
			</font><font SIZE="2" COLOR="#7f0055"><b><font face="Courier"><br>
			public</font></b></font><font face="Courier"><font SIZE="2"> </font>
			<font SIZE="2" COLOR="#7f0055"><b>class</b></font><font SIZE="2"> 
		SwingJFrameTest </font><font SIZE="2" COLOR="#7f0055"><b>extends</b></font></font><font face="Courier" SIZE="2"> 
		JFrame {<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp;
			</b></font><font face="Courier"><font SIZE="2" COLOR="#7f0055"><b>public</b></font><font SIZE="2">
			</font><font SIZE="2" COLOR="#7f0055"><b>static</b></font><font SIZE="2">
			</font><font SIZE="2" COLOR="#7f0055"><b>void</b></font></font><font face="Courier" SIZE="2"> 
			main(String[] args) {<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; 
			&nbsp;&nbsp;&nbsp; try</b></font><font face="Courier" SIZE="2"> 
				{<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
			</b></font><font face="Courier" SIZE="2">SwingJFrameTest frame =
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>new</b></font><font face="Courier" SIZE="2"> 
					SwingJFrameTest();<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
			</b></font><font face="Courier" SIZE="2">frame.setVisible(</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>true</b></font><font face="Courier" SIZE="2">);<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </b>
			</font><font face="Courier" SIZE="2">} </font>
			<font SIZE="2" COLOR="#7f0055" face="Courier"><b>catch</b></font><font face="Courier" SIZE="2"> 
				(Exception e) {<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp;
			&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
			</b></font><font face="Courier" SIZE="2">e.printStackTrace();<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </b>
			</font><font face="Courier" SIZE="2">}<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; </b>
			</font><font face="Courier" SIZE="2">}<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; public</b></font><font face="Courier" SIZE="2"> 
			SwingJFrameTest() {<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </b>
			</font><font face="Courier" SIZE="2">setBounds(100, 100, 450, 300);<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </b>
			</font><font face="Courier" SIZE="2">setDefaultCloseOperation(JFrame.</font><font SIZE="2" COLOR="#0000c0" face="Courier"><i>EXIT_ON_CLOSE</i></font><font face="Courier" SIZE="2">);<br>
			</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp;
			</b></font><font SIZE="2"><font face="Courier">}<br>
			}</font></p>
		</blockquote>
		</font>
      <p>If the <b>Use advanced template for generated JFrame</b> option is 
		checked, the following code is generated which adds an empty 5 pixel 
		margin to the entire window:</p><font SIZE="2">
		<blockquote>
			<dl>
				<dd></font><font SIZE="2" COLOR="#7f0055"><b>
				<font face="Courier">private</font></b></font><font face="Courier"><font SIZE="2"> 
				JPanel </font><font SIZE="2" COLOR="#0000c0">m_contentPane</font><font SIZE="2">;<br>
				</font>...</font><br>
				<font SIZE="2" COLOR="#7f0055" face="Courier"><b>public</b></font><font face="Courier" SIZE="2"> 
				SwingJFrameTest() {<br>
				</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; </b>
				</font><font face="Courier" SIZE="2">setDefaultCloseOperation(JFrame.</font><font SIZE="2" COLOR="#0000c0" face="Courier"><i>EXIT_ON_CLOSE</i></font><font face="Courier" SIZE="2">);<br>
				</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>
				&nbsp;&nbsp;&nbsp; </b></font><font face="Courier" SIZE="2">setBounds(100, 100, 450, 300);<br>
				</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; </b>
				</font><font face="Courier"><font SIZE="2" COLOR="#0000c0">m_contentPane</font><font SIZE="2"> 
					= </font><font SIZE="2" COLOR="#7f0055"><b>new</b></font></font><font face="Courier" SIZE="2"> 
					JPanel();<br>
				</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>&nbsp;&nbsp;&nbsp; </b>
				</font><font face="Courier" SIZE="2">setContentPane(</font><font SIZE="2" COLOR="#0000c0" face="Courier">m_contentPane</font><font face="Courier" SIZE="2">);<br>
				</font><font SIZE="2" COLOR="#7f0055" face="Courier"><b>
				&nbsp;&nbsp;&nbsp; </b></font><font face="Courier">
				<font SIZE="2" COLOR="#0000c0">m_contentPane</font><font SIZE="2">.setBorder(</font><font SIZE="2" COLOR="#7f0055"><b>new</b></font></font><font SIZE="2"><font face="Courier"> 
					EmptyBorder(5, 5, 5, 5));</font></dd>
				<dd><font face="Courier">}</font></dd>
			</dl>
		</blockquote>
		</font>
		<p>When editing Swing JFrames, all of the standard Swing layouts,
      containers, widgets and menus are available. Custom or third party
      controls may be added via the <b>
		<a href="../../../com.instantiations.designer.doc.user/html/userinterface/palette.html">Choose 
		Component</a></b> command. You may also
      preview your frame using different look and feels using the drop down look
      and feel list in the toolbar.</p>
    </td>
  </tr>
</table>
</body>
</html>
